Object
Provides functionality to work on object datatypes. Persistence is one of the main features. Currently supported data format: JSON (file extension “.json”) and MessagePack (file extension .msgpack)
- Object.clone(obj)
- Argument:
obj (
const auto)
- Return type:
auto
Creates a full deep copy clone of the provided object/handle. Can fail if the object/handle does not support cloning.
- Object.deserialize(serializedData, dataFormat)
- Arguments:
serializedData (
binary)dataFormat (
enum)
- Return type:
auto
De-Serializes an object from a byte array
- Object.getType(obj)
- Argument:
obj (
const auto)
- Return type:
string
Returns the type name of an object/handle which is the CROWN name assigned to the object
- Object.load(fileName, dataFormat)
- Arguments:
fileName (
string)dataFormat (
enum)
- Return type:
auto
Loads an object/handle content from a file. When the type parameter is not passed, the data format is guessed from the file extension.
- Object.save(obj, fileName, dataFormat)
- Arguments:
obj (
const auto)fileName (
string)dataFormat (
enum)
- Return type:
boolean
Saves an object content to a file. If the data type enumeration is not passed as argument, the file extension is used to guess the data format.
- Object.serialize(obj, dataFormat)
- Arguments:
obj (
const auto)dataFormat (
enum)
- Return type:
binary
Serializes an object to a byte array
- Object.toConst(obj)
- Argument:
obj (
const object)
- Return type:
const object
Return the provided object explicitly as const object. This is useful to guarantee further const usage of the object. The input object is not touched and stays non-const.